﻿using System;
using System.Collections.Generic;
using System.Linq;

using HelfenHelfen.DataAccess.Entities;
using HelfenHelfen.DataAccess.Interfaces;

namespace HelfenHelfen.DataAccess {
   public class DemandDetailDataAccess : IDemandDetailDataAccess {

      public void Insert(DemandDetail newDemandDetail) {
         throw new NotImplementedException();
      }

      public void Update(Demand updateDemandDetail) {
         throw new NotImplementedException();
      }

      public void Delete(Guid demandDetailId) {
         throw new NotImplementedException();
      }

      public DemandDetail Get(Guid demandDetailId) {
         using (HelfenHelfenEntities db = new HelfenHelfenEntities()) {
            var obj = (from demand in db.DemandDetails
                       where demand.DemandGUID == demandDetailId
                       select demand).FirstOrDefault();
            return obj;
         } 
      }

      public IList<DemandDetail> GetAllByDemand(Guid demandId) {
         using (HelfenHelfenEntities db = new HelfenHelfenEntities()) {
            var obj = (from demand in db.DemandDetails
                       where demand.DemandGUID == demandId
                       select demand).ToList();
            return obj;
         }
      }
   }
}
